import _regeneratorRuntime from "@babel/runtime/regenerator";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

/**
 * @creationDate 2019/12/25
 */
import request from "../../utils/request";
import { getEnvConfig } from "../../utils/iocUtils";
import { getCurrentOrganizationId, isTenantRoleLevel } from "../../utils/utils";
/**
 * 通用查询数据审计记录
 * @param {string} params.entityCode 审计代码
 * @param {number} params.entityId 审计实体ID
 */

export function queryAuditVersion(_x) {
  return _queryAuditVersion.apply(this, arguments);
}

function _queryAuditVersion() {
  _queryAuditVersion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    var _getEnvConfig, CPAAS_MNT, organizationId;

    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _getEnvConfig = getEnvConfig(), CPAAS_MNT = _getEnvConfig.CPAAS_MNT;
            organizationId = getCurrentOrganizationId();
            return _context.abrupt("return", request(isTenantRoleLevel() ? "".concat(CPAAS_MNT, "/v1/").concat(organizationId, "/audit-datas") : "".concat(CPAAS_MNT, "/v1/audit-datas"), {
              method: 'GET',
              query: _objectSpread({}, params)
            }));

          case 3:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _queryAuditVersion.apply(this, arguments);
}